<template>
  <!-- 出勤天数 -->
  <div class="app-container">
    <div id="divSearch" ref="divSearch">
      <el-form :inline="true" :model="Search" size="mini" class="demo-form-inline">
        <el-form-item label="工号: " prop="Search">
          <el-input placeholder="工号" v-model="Search.Account"/>
        </el-form-item>
        <el-form-item label="发放月份：" prop="Search">
          <el-date-picker v-model="Search.SendMonth" type="month" value-format="yyyy-MM" placeholder="选择月">
          </el-date-picker>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="getSearch">查询</el-button>
        </el-form-item>
      </el-form>
    </div>

    <div style="width: 100%;">
      <el-table :data="form" style="width: 100%;" size="mini" border >
        <el-table-column align="center" label="工号" width="130px">
          <template slot-scope="scope">
            {{ scope.row.Account }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="姓名" width="180px">
          <template slot-scope="scope">
            {{ scope.row.Name }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="聘用日期" width="180px">
          <template slot-scope="scope">
            {{ scope.row.EntryDate }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="分公司-班组-拉线">
          <template slot-scope="scope">
            {{ scope.row.OrganizeName }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="岗位">
          <template slot-scope="scope">
            {{ scope.row.JobName }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="级别">
          <template slot-scope="scope">
            {{ scope.row.JobLevel }}
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div style="width: 100%; ">
      <el-table :data="formDetail" style="width: 100%;" size="mini" border @sort-change="sortChange">
        <el-table-column align="center" label="工号" width="130px">
          <template slot-scope="scope">
            {{ scope.row.UserCode }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="是否出勤" width="180px">
          <template slot-scope="scope">
            {{ scope.row.IsAttendance==1?'是':'否' }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="日期" >
          <template slot-scope="scope">
            {{ scope.row.AttenceDate }}
          </template>
        </el-table-column>


        <el-table-column align="center" label="出勤小时数" width="180px">
          <template slot-scope="scope">
            {{ scope.row.WorkingHours }}
          </template>
        </el-table-column>


      </el-table>
    </div>
  </div>






</template>

<script>
  import path from 'path'
  import {
    deepClone
  } from '@/utils'
  import {
    getDataList,
    getAttendance
  } from '@/api/school'

  export default {

    data() {
      return {
        form: [],
        formDetail: [],
        Search: { // 查询条件
          RNO: '009', // 表编号  根据Controller中对应的表编号
          jsWhere: '' // 自定义条件
        },
        SearchNoSm: { // 查询条件
          RNO: '009', // 表编号  根据Controller中对应的表编号
          jsWhere: '' // 自定义条件
        },
      }
    },
    computed: {

    },
    created: function() {
      if(this.$route.query.JumpID!=''&&this.$route.query.JumpID!=null&&this.$route.query.SendMonth!=''&&this.$route.query.SendMonth!=null){
        this.getDataList();
      }

    },
    methods: {
      async getDataList(){
        this.Search.Account = this.$route.query.JumpID
        const res = await getDataList({
          data: JSON.stringify(this.Search)
        })
        this.form = res.data.Table
        const resDetail = await getAttendance({
          billid: this.$route.query.JumpID,
          sendDate: this.$route.query.SendMonth
        })
        this.formDetail = resDetail.data.Table

      },
      async getSearch(){
        this.SearchNoSm.Account = this.Search.Account
        const res = await getDataList({
          data: JSON.stringify(this.SearchNoSm)
        })
        this.form = res.data.Table
        const resDetail = await getAttendance({
          billid: this.Search.Account,
          sendDate: this.Search.SendMonth
        })
        this.formDetail = resDetail.data.Table
      }
    }
  }
</script>

<style>
</style>
